﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefIntgrSyncRemote" :model="stateIntgrSyncRemote.vmModel" label-width="100px">
    <div style="margin-bottom:10px;">{{$t('message.autotrans.SysBatchEditConfirm')}}</div>
    <el-row>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Wo_FormItem" prop="LinkedVM.Wo" :label="$t('message.autotrans._Model_IntgrSyncRemote_Wo')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.Wo" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Sn_FormItem" prop="LinkedVM.Sn" :label="$t('message.autotrans._Model_IntgrSyncRemote_Sn')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_Sn')}), trigger: 'blur' }]" >
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.Sn" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_TransSnId_FormItem" prop="LinkedVM.TransSnId" :label="$t('message.autotrans._Model_IntgrSyncRemote_TransSnId')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.TransSnId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ArchiveId_FormItem" prop="LinkedVM.ArchiveId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ArchiveId')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.ArchiveId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_LineId_FormItem" prop="LinkedVM.LineId" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineId')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.LineId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_LineCode_FormItem" prop="LinkedVM.LineCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineCode')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.LineCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ProductId_FormItem" prop="LinkedVM.ProductId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductId')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.ProductId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ProductName_FormItem" prop="LinkedVM.ProductName" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductName')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.ProductName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OpId_FormItem" prop="LinkedVM.OpId" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpId')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.OpId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OpCode_FormItem" prop="LinkedVM.OpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpCode')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_OpCode')}), trigger: 'blur' }]" >
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.OpCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ErpOpCode_FormItem" prop="LinkedVM.ErpOpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErpOpCode')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.ErpOpCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PassResult_FormItem" prop="LinkedVM.PassResult" :label="$t('message.autotrans._Model_IntgrSyncRemote_PassResult')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_PassResult')}), trigger: 'blur' }]" >
          <el-select v-model="stateIntgrSyncRemote.vmModel.LinkedVM.PassResult" clearable>
             <el-option key="OK" value="OK" :label="$t('message.autotrans._Enum_SnStatusEnum_OK')"></el-option>
             <el-option key="NG" value="NG" :label="$t('message.autotrans._Enum_SnStatusEnum_NG')"></el-option>
             <el-option key="MandatoryOK" value="MandatoryOK" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryOK')"></el-option>
             <el-option key="MandatoryNG" value="MandatoryNG" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryNG')"></el-option>
             <el-option key="Scrap" value="Scrap" :label="$t('message.autotrans._Enum_SnStatusEnum_Scrap')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Status_FormItem" prop="LinkedVM.Status" :label="$t('message.autotrans._Model_IntgrSyncRemote_Status')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_Status')}), trigger: 'blur' }]" >
          <el-select v-model="stateIntgrSyncRemote.vmModel.LinkedVM.Status" clearable>
             <el-option key="Ready" value="Ready" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Ready')"></el-option>
             <el-option key="Completed" value="Completed" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Completed')"></el-option>
             <el-option key="Failure" value="Failure" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Failure')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_IsFirst_FormItem" prop="LinkedVM.IsFirst" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsFirst')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_IsFirst')}), trigger: 'blur' }]" >
          <el-switch v-model="stateIntgrSyncRemote.vmModel.LinkedVM.IsFirst" clearable></el-switch>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_IsCompelted_FormItem" prop="LinkedVM.IsCompelted" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsCompelted')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_IsCompelted')}), trigger: 'blur' }]" >
          <el-switch v-model="stateIntgrSyncRemote.vmModel.LinkedVM.IsCompelted" clearable></el-switch>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_SyncMethod_FormItem" prop="LinkedVM.SyncMethod" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncMethod')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.SyncMethod" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_SyncCount_FormItem" prop="LinkedVM.SyncCount" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncCount')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_SyncCount')}), trigger: 'blur' }]" >
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.SyncCount" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ErrMessage_FormItem" prop="LinkedVM.ErrMessage" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErrMessage')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.ErrMessage" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_CreatedTime_FormItem" prop="LinkedVM.CreatedTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_CreatedTime')">
          <el-date-picker v-model="stateIntgrSyncRemote.vmModel.LinkedVM.CreatedTime" type='date' clearable></el-date-picker>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_StartTime_FormItem" prop="LinkedVM.StartTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_StartTime')">
          <el-date-picker v-model="stateIntgrSyncRemote.vmModel.LinkedVM.StartTime" type='date' clearable></el-date-picker>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_EndTime_FormItem" prop="LinkedVM.EndTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_EndTime')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_EndTime')}), trigger: 'blur' }]" >
          <el-date-picker v-model="stateIntgrSyncRemote.vmModel.LinkedVM.EndTime" type='date' clearable></el-date-picker>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Remark_FormItem" prop="LinkedVM.Remark" :label="$t('message.autotrans._Model_IntgrSyncRemote_Remark')">
          <el-input v-model="stateIntgrSyncRemote.vmModel.LinkedVM.Remark" clearable></el-input>
      </el-form-item>

      </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitIntgrSyncRemote"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

      <WtmButton @click="onCloseIntgrSyncRemote"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

    </div>

  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageIntegrationManagementIntgrSyncRemoteBatchEdit;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { intgrsyncremoteApi } from '/@/api/integrationmanagement/intgrsyncremote';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefIntgrSyncRemote = ref();
const stateIntgrSyncRemote = reactive({
    vmModel: {
	  LinkedVM:{
        Wo: '',
        Sn: '',
        LineCode: '',
        ProductName: '',
        OpCode: '',
        ErpOpCode: '',
        PassResult: undefined,
        Status: undefined,
        IsFirst: undefined,
        IsCompelted: undefined,
        SyncMethod: '',
        ErrMessage: '',
        CreatedTime: undefined,
        StartTime: undefined,
        EndTime: undefined,
        Remark: '',
      },
      Ids:[],
      
	},
    
});

// 取消
const onCloseIntgrSyncRemote = () => {
    closeDialog();
};

// 提交
const onSubmitIntgrSyncRemote = () => {
	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});

    formRefIntgrSyncRemote.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            intgrsyncremoteApi().batchedit(stateIntgrSyncRemote.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error:any) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};


// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateIntgrSyncRemote.vmModel.Ids = ci.attrs["wtmdata"];
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateIntgrSyncRemote.vmModel.Ids = useRouter().currentRoute.value.query.id as any;
	}

});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

